<template>
	<view class="container">
		<view class="card" @click="$wanlshop.to('/pages/product/goods?id='+detail.id)">
			<!-- 第一部分：左侧图片 -->
			<view class="first-item">
				<image class="left-image" :src="$wanlshop.oss(detail.image,0,0)" mode="aspectFill"></image>
			</view>
			<!-- 第二部分：主要信息 -->
			<view class="second-item main-info">
				<!-- 标题区域 -->
				<view class="title-section">
					<text class="title">{{detail.title}}</text>
					<view class="sub-info">
						<text class="ranking">{{detail.description}}</text>
						<view class="distance">
							<text>距你3.9km | 道里区</text>
						</view>
					</view>
					<view class="price-tag">
						<text>门票</text>
						<text class="price">￥{{detail.price}}</text>
						<text>起</text>
					</view>
				</view>
			
			</view>
		</view>
		
		<!-- 第三部分：优惠标签 预售信息-->
		<view class="info-contain"  v-for="(item,index) in detail.sku">
				
			<!-- 左侧优惠标签 -->
			<view class="left-tag">已优惠¥{{item.market_price-item.price}}</view>

			<!-- 右侧内容 -->
			<view class="right-section">
				<view class="presale-tag">预售</view>
				<view class="price-group">
					<text class="price">¥{{item.price}}</text>
					<text class="desc">{{item.difference}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['detail'],
		data() {
			return {
				// 可以在此处定义数据绑定
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 20rpx;
		background-color: #fff;
	}
	
	.first-item{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.second-item {
	  margin: 20rpx;
	}
	
	.card{
		display: flex;
		background-color: #fff;
		padding: 20rpx;
	}

	.left-image {
		width: 140rpx;
		height: 140rpx;
		border-radius: 12rpx;
		margin-right: 20rpx;
	}

	.main-info {
		flex: 1;
		position: relative;
	}

	.title-section {
		.title {
			font-size: 32rpx;
			font-weight: bold;
			color: #333;
			display: block;
			margin-bottom: 10rpx;
		}

		.sub-info {
			position: relative;
			left: 0;
			bottom: 0;
			margin-bottom: 8rpx;

			text {
				font-size: 22rpx;
				margin-right: 20rpx;
			}
		}

		.ranking {
			width: auto;
			background-color: #FCEDED;
			color: #D82145;
			padding: 5rpx;
			border-radius: 8rpx;
		}

		.price-tag {
			position: absolute;
			bottom: 0;
			right: 0;
			float: right;

			text {
				font-size: 26rpx;
			}
		}

		.price {
			color: #e54d42;
			font-size: 30rpx !important;
			font-weight: bold;
		}
	}

	.info-contain {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10rpx;
		background-color: #fff;
		
	}

	/* 左侧优惠标签 */
	.left-tag {
		background: #FFECE5;
		color: #E02020;
		font-size: 20rpx;
		padding: 8rpx 16rpx;
		border-radius: 8rpx;
	}

	/* 右侧整体容器 */
	.right-section {
		display: flex;
		align-items: center;
		gap: 16rpx;
	}

	/* 预售标签 */
	.presale-tag {
		background: #E02020;
		color: #fff;
		font-size: 20rpx;
		padding: 6rpx 20rpx;
		border-radius: 30rpx;
		white-space: nowrap;
	}
	.price {
		color: #E02020;
		font-size: 28rpx;
		font-weight: bold;
		line-height: 1.4;
	}

	.desc {
		color: #666;
		font-size: 26rpx;
		white-space: nowrap;
	}
</style>